<?php

/**
 * Destination form base class.
 *
 * @method Destination getObject() Returns the current form's model object
 *
 * @package    mercure
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseDestinationForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'iddestination'     => new sfWidgetFormInputHidden(),
      'idloc_lieudepart'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation_3'), 'add_empty' => false)),
      'idloc_lieuarrivee' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation'), 'add_empty' => false)),
      'idpriseencharge'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Transfert'), 'add_empty' => false)),
      'heuredepart'       => new sfWidgetFormDate(),
      'heurearrivée'     => new sfWidgetFormDate(),
      'numordre'          => new sfWidgetFormInputText(),
    ));

    $this->setValidators(array(
      'iddestination'     => new sfValidatorChoice(array('choices' => array($this->getObject()->get('iddestination')), 'empty_value' => $this->getObject()->get('iddestination'), 'required' => false)),
      'idloc_lieudepart'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation_3'))),
      'idloc_lieuarrivee' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Localisation'))),
      'idpriseencharge'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Transfert'))),
      'heuredepart'       => new sfValidatorDate(array('required' => false)),
      'heurearrivée'     => new sfValidatorDate(array('required' => false)),
      'numordre'          => new sfValidatorInteger(),
    ));

    $this->widgetSchema->setNameFormat('destination[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Destination';
  }

}
